# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>

pkgname=libgudev
pkgver=238
pkgrel=1
pkgdesc="GObject bindings for libudev"
url="https://wiki.gnome.org/Projects/libgudev"
arch=(loong64 x86_64)
license=(LGPL2.1)
depends=(
  glib2
  systemd
)
makedepends=(
  git
  gobject-introspection
  gtk-doc
  meson
  umockdev
  vala
)
_commit=df7c9c9940160307aaeb31347f4776a46f8736a9  # tags/238^0
source=("git+https://gitlab.gnome.org/GNOME/libgudev.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd libgudev
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd libgudev

  # Use a locale with "," decimal separator that we
  # actually have available in the build environments
  sed -e 's/fr_FR\.UTF-8/de_DE.UTF-8/g' \
      -i tests/meson.build tests/test-double.c
}

build() {
  local meson_options=(
    -D gtk_doc=true
  )

  arch-meson libgudev build "${meson_options[@]}"
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  depends+=(libg{lib,object}-2.0.so libudev.so)
  provides+=(libgudev-1.0.so)

  meson install -C build --destdir "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
